package me.zhengjie.modules.management.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.management.domain.Pageable;
import me.zhengjie.modules.management.mapper.MrAppointmentRepMapper;
import me.zhengjie.modules.management.service.MrAppointmentRepService;
import me.zhengjie.modules.management.service.dto.ConferenceRecordQueryCriteria;
import me.zhengjie.modules.management.service.dto.MrRecordRepDto;
import me.zhengjie.utils.PageHelpResultUtil;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author: chenxin.jiang
 * @Date: 2020/12/17
 * @Description:
 */
@Service
@RequiredArgsConstructor
public class MrAppointmentRepServiceImpl implements MrAppointmentRepService {

    private final MrAppointmentRepMapper appointmentRepMapper;
    @Override
    public Map<String, Object> Query(ConferenceRecordQueryCriteria conferenceRecordQueryCriteria, Pageable pageable) {
        PageHelper.startPage(pageable.getPage(),pageable.getSize());
        List<MrRecordRepDto> query = appointmentRepMapper.Query(conferenceRecordQueryCriteria);
        PageInfo<MrRecordRepDto> pageInfo=new PageInfo<>(query);
        return PageHelpResultUtil.toPage(pageInfo);
    }

    @Override
    public List<MrRecordRepDto> Export(ConferenceRecordQueryCriteria conferenceRecordQueryCriteria) {
        List<MrRecordRepDto> query = appointmentRepMapper.Query(conferenceRecordQueryCriteria);
        return query;
    }
}
